package com.chinamobile.iot.mqtt.spi.model;

/**
 * the QoS1 message that waiting for ack from client
 * if the clean session = false, they should be saved to the redis
 * if the clean session = true, then it is just keep in memory
 * Created by szl on 2017/7/28.
 */
public class WaitAckMessage {
    /**
     * the clean session flag of the client
     */
    private boolean cleanSession;
    /**
     * the message waiting for ack from client
     */
    private Qos1Message message;

    public boolean isCleanSession() {
        return cleanSession;
    }

    public void setCleanSession(boolean cleanSession) {
        this.cleanSession = cleanSession;
    }

    public Qos1Message getMessage() {
        return message;
    }

    public void setMessage(Qos1Message message) {
        this.message = message;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        WaitAckMessage that = (WaitAckMessage) o;

        return message != null ? message.equals(that.message) : that.message == null;
    }

    @Override
    public int hashCode() {
        return message != null ? message.hashCode() : 0;
    }
}
